﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class CampusDynamicList : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        NewsDataClassesDataContext dc = new NewsDataClassesDataContext();
        var Catalogs = from catalog in dc.Catalogs
                       where catalog.Catalog_id.Equals(5)
                       select new
                       {
                           Catalog_id = catalog.Catalog_id,
                           Name = catalog.CatalogName
                       };
        foreach (var catalog in Catalogs)
        {
            ListHyperLink.Text = catalog.Name + "列表";
        }
    }
    protected void NewsListGridView_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
    {
        Session.Add("News_id", ((Label)NewsListGridView.Rows[e.NewSelectedIndex].FindControl("News_id")).Text);
        Response.Redirect("CampusDynamic.aspx");
    }
    protected void NewsListGridView_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            LinkButton News_title = e.Row.FindControl("News_title") as LinkButton;
            News_title.Text = HtmlFormat.HtmlFormat.DeleteHtmlFormat(News_title.Text);
        }
    }
}
